package terra.model.runnable;

import terra.managers.MapManager;
import terra.model.map.Map;
import terra.network.Server;

public class WaterTileChangesBroadcaster implements Runnable {

	@Override
	public void run() {
		try {
			if (Server.getInstance().all.size() == 0)
				return;
			for (int i = MapManager.getInstance().minMapIndex; i < MapManager
					.getInstance().maxMapIndex; i++) {
				Map m = MapManager.getInstance().getMap(i);
				if (!m.active)
					continue;
				if (m.getWater().size() == 0)
					continue;
				m.sendWater();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
